<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSalePromotionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sale_promotion', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('gid');
            $table->integer('pid');
            $table->string('gname', 50)->unique();
            $table->float('sale_price', 9, 2);
            $table->integer('sale_start_time');
            $table->integer('sale_end_time');
            $table->unsignedTinyInteger('sale_sort')->comment('0 1 2 ….数值越大越权重越大');
            $table->unsignedTinyInteger('ad_address')->comment('1、广告左边 2、广告右边 3、广告中间');
            $table->string('path', 255);
            $table->string('attr', 50)->nullable();
            $table->string('attr1', 100)->nullable();
            $table->string('attr2', 150)->nullable();
            $table->timestamps();

            //后来新增的

            $table->unsignedTinyInteger('state')->comment('1代表生效  2代表失效')->default(1);

            $table->unsignedTinyInteger('state')->default('0')->comment('1代表生效  2代表失效');


        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sale_promotion');
    }
}
